package com.java.grammer;
/**
 * 两个变量 a，b，他们的积为2048，求他们和的最小值
 */

/**
 * @Description
 * @author xiaoqi   Email:1404899001@qq.com
 * @version
 * @date 2020-11-21 9:24:57
 */
public class ForTest_3 {
    public static void main(String[] args) {

        for (int a = 1; a <= 2048; a++) {
            if (2048 % a != 0) {
                continue;
            }
            int b = 2048 / a;
            int minAdd = 2049;
            if (a + b < minAdd) {
                minAdd = a + b;
                System.out.print("  a = " + a + " b =" + b + " 总和为 " + minAdd);
            }
        }
    }
}

